Skip to content

Rust: fix workspace member aggregation when absolute path is a glob pattern #19293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

redsun82
Copy link
Contributor

We were interpreting the absolute path of a workspace as a glob pattern, which doesn't work if the path has some special characters (e.g. [ or ]).

…attern

We were interpreting the absolute path of a workspace as a glob pattern,
which doesn't work if the path has some special characters (e.g. `[` or
`]`).
@Copilot Copilot AI review requested due to automatic review settings April 11, 2025 14:43
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Apr 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes workspace member aggregation by resolving an issue where workspace absolute paths containing special characters were misinterpreted as glob patterns.

  • Change the matching behavior by stripping the workspace_dir from the target path.
  • Compare the resulting relative path against each member glob pattern from the workspace configuration.
Comments suppressed due to low confidence (1)

rust/extractor/src/rust_analyzer.rs:179

  • [nitpick] The closure parameter 'p' is used for both the member string and the generated glob::Pattern. Consider renaming the inner parameter (or both) to more descriptive names (e.g., 'pattern_str' and 'pattern') to improve clarity.
.any(|p| glob::Pattern::new(p).is_ok_and(|p| p.matches(rel_path.as_str())))

Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@redsun82 redsun82 merged commit c245459 into main Apr 14, 2025
16 checks passed
@redsun82 redsun82 deleted the redsun82/rust-fix-member-aggregation branch April 14, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants